package com.example.flutter_test_opengl_plugin.surface_view

import android.content.Context
import android.graphics.Color
import android.util.Log
import android.view.SurfaceHolder
import android.view.SurfaceView
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams
import android.widget.FrameLayout
import com.example.flutter_test_opengl_plugin.JNIProxy
import com.example.flutter_test_opengl_plugin.board.WhiteboardTextureView
import io.flutter.plugin.platform.PlatformView


class MySurfaceViewGroup(
    private var realContext: Context,
): PlatformView {
    var surfaceView0 = SurfaceView(realContext)
    var surfaceView1 = TriangleSurfaceView(realContext)
    val parentLayout: FrameLayout = FrameLayout(realContext).apply {
        layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
//        layoutParams = FrameLayout.LayoutParams(800, 800)
        setBackgroundColor(Color.BLUE)
//        setBackgroundColor(Color.BLACK)
    }

    init {
        parentLayout.setOnTouchListener { v, event ->
            Log.d("ssss", "触摸了openglView：${event.action}")
            false
        }
        parentLayout.addView(surfaceView1)
    }

    override fun getView(): View {
//        return surfaceView
        return parentLayout
    }

    override fun dispose() {
        // 处理你的SurfaceView的销毁逻辑
    }

}